<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>审核管理</title>
</head>
<body>
    <div id="audit_toolbar" class="search-div" style="margin: 10px 10px 40px">
        <!-- 查询条件区域 -->
        <div class="search-content">
            <span>
                <label>标题：</label>
                <input type="text" name="rulesTitle"  class="span2" />
                &nbsp;<i class="boot_icon-question-sign" selectLike="tooltip"></i>
            </span>
            <span>
                <label>类型：</label>
                <select name="rulesTypeid" style="width: 110px;">
                    <option value="">==请选择==</option>
                </select>
            </span>
        </div>
        <!-- 功能区域 -->
        <div class="search-toolbar" >
            <span style="float:left;">
                <a class="easyui-linkbutton clearDgChecked"  icon="icon-redo"	plain="true"  title="清空所有勾选项" >清空勾选</a>
                <a  class="easyui-linkbutton"  icon="icon-add"	plain="true" title="添加审核"  id="audit_add" ><span>添加审核 </span></a>
                <a class="easyui-linkbutton"  icon="icon-edit"	plain="true" title="修改修改审核"  id="audit_update" ><span>修改修改审核</span></a>
                <a class="easyui-linkbutton"  icon="icon-remove"	plain="true"title="确定要删除吗?" id="audit_delete" ><span>批量删除</span></a>
            </span>
            <span style="float:right">
                <button class="btn btn-primary btn-small" type="submit">查询</button>&nbsp;
                <button class="btn btn-small clear" type="button" >清空</button>&nbsp;
            </span>
        </div>
    </div>

    <!--表格-->
    <table id="audit_dg"></table>

    <!--弹窗，当点击事件触发时显示-->
    <div id="audit_add_dialog"></div>
    <!--修改弹窗-->
    <div id="audit_update_dialog"></div>
    <!--删除弹窗-->
    <div id="audit_delete_dialog"></div>
    <script>
        $(function () {
            //1.初始：页面加载时，jq创建表头，并且查询json文件数据，对应<table id="audit_dg"></table>
            $('#audit_dg').datagrid({
                width:'100%',
                url:'testJson/audit_json.json',//ajax请求数据文件，后台写好接口返回数据，目前用josn文件模拟
                frozenColumns:[[
                    {
                        field:"id",
                        title : "勾选",
                        checkbox:true
                    }
                ]],
                columns:[[
                    {field:'code',title:'编号',width:100},
                    {field:'name',title:'姓名',width:100},
                    {
                        field:'studentNum',
                        title:'学号',
                        width:100,
                        formatter: function(value,row,index){
                            return '<a href="#"  onclick="editAudit('+index+')" title="查看详情" >'+value+'</a>';
                        }

                    },
                    {field:'state',title:'审核状态',width:100},
                    {field:'price',title:'价格',width:100,align:'right'},
                    {
                        field : "delete",
                        title : "操作",
                        align:"center",
                        width : 100,
                        formatter: function(value,row,index){
                            return '<a  href="#">删除</a>';
                        }
                    } ,
                ]]
            });
            //增加数据
            $("#audit_add").on("click",function () {
                $('#audit_add_dialog').dialog({
                    title: '增加审核数据',
                    width: 600,
                    height: 400,
                    closed: false,
                    cache: false,
                    href: 'page/audit/audit_add.html',
                    modal: true
                });
            });
        //    修改数据
            $("#audit_update").on("click",function () {
                $('#audit_update_dialog').dialog({
                    title: '修改审核数据',
                    width: 600,
                    height: 400,
                    closed: false,
                    cache: false,
                    href: 'page/audit/audit_update.html',
                    modal: true
                });
            });
        //    删除数据
            $("#audit_delete").on("click",function () {
                $('#audit_delete_dialog').dialog({
                    title: '删除审核数据',
                    width: 600,
                    height: 400,
                    closed: false,
                    cache: false,
                    href: 'page/audit/audit_delete.html',
                    modal: true
                });
            });

        });

        function editAudit(index) {
            var rows = $('#audit_dg').datagrid('getRows');//获得所有行
            var row = rows[index];//根据index获得其中一行。
            //弹窗显示当前行信息
            $('#audit_add_dialog').dialog({
                title: '查看详情',
                width: 600,
                height: 400,
                textAlign:"center",
                cache: false,
                queryParams: { checksysno: row },
                href: 'page/audit/details_add.html',
                modal: true
            });

        }

    </script>
</body>
</html>